package com.my.code.pool;

import java.util.Arrays;

/**
 * 使用java8的stream reduce
 * 并行流底层还是Fork/Join框架，只是任务拆分优化得很好
 */
public class ReduceAcc implements Accumulation {
    @Override
    public long acc(long[] numbs) {
        return Arrays.stream(numbs).parallel().reduce(0, Long::sum);
    }
}
